package com.example.train_operate.controller;

import com.example.train_operate.entity.Cabinet;
import com.example.train_operate.service.CabinetService;
import com.example.train_operate.util.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@CrossOrigin
@Api(tags = "机柜外观检查任务接口")
@RequestMapping("/cabinet")
public class CabinetController {

    @Resource
    private CabinetService cabinetService;

    /**
     * 添加机柜外观检查任务
     * @param cabinet
     * @return
     */
    @PostMapping("/addCabinet")
    @ApiOperation("添加机柜外观检查任务")
    public Result addCabinet(@RequestBody Cabinet cabinet){
        return cabinetService.addCabinet(cabinet);
    }

    /**
     * 根据id查询机柜外观检查任务
     * @param cabinetId
     * @return
     */
    @GetMapping("/getCabinetById/{cabinetId}")
    @ApiOperation("根据id查询机柜外观检查任务")
    public Result getCabinetById(@PathVariable Integer cabinetId){
        return cabinetService.getCabinetById(cabinetId);
    }
    /**
     * 修改机柜外观检查任务
     * @param cabinet
     * @return
     */
    @PutMapping("/updateCabinet")
    @ApiOperation("修改机柜外观检查任务")
    public Result updateCabinet(@RequestBody Cabinet cabinet){
        return cabinetService.updateCabinet(cabinet);
    }

}
